package com.linx.common.translation.core.impl;

import com.linx.common.core.service.MenuTypeService;
import com.linx.common.translation.annotation.TranslationType;
import com.linx.common.translation.constant.TransConstant;
import com.linx.common.translation.core.TranslationInterface;
import lombok.AllArgsConstructor;

/**
 * 菜单类型翻译实现
 *
 * @author Lion Li
 */
@AllArgsConstructor
@TranslationType(type = TransConstant.APP_MENU_TYPE_IDTO_NAME)
public class AppMenuTypeIdToNameTranslationImpl implements TranslationInterface<String> {

    private final MenuTypeService menuTypeService;

    @Override
    public String translation(Object key, Object key2, String other, Class<?> clazz) {
        if (key == null || key.toString().isEmpty()) {
            return null;
        }

        return menuTypeService.selectMenuTypeNameById(key);
    }

}
